package com.guoliang.statisticsService.schedule;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.guoliang.statisticsService.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author ：Leo
 * @date ：Created in 2023/2/1 15:36
 * @description：
 */
@Component
public class ScheduledTask {
    @Autowired
    StatisticsDailyService statisticsDailyService;
    @Scheduled(cron = "0 0 1 * * ?")
    public void task(){
        DateTime yesterday = DateUtil.yesterday();
        String day =DateUtil.formatDate(yesterday);
        System.out.println(day);
        statisticsDailyService.createStaByDay(day);
    }
}
